// A-S-M team
// Project: BattleCity
// Created: 22.03.2012
// Last change: 22.03.2012
// Description: implementation of landscape-builder static class

#include "landscapebuilder.h"
#include "play.h"

void LandscapeBuilder::build(CL_Rect dest, CL_String sprite_name, ObjectType type)
{
	for (int i = dest.get_top_left().x; i < dest.get_top_right().x; i += ORIGINAL_MIN_PIXEL)
	{
		for (int j = dest.get_top_left().y; j < dest.get_bottom_left().y; j += ORIGINAL_MIN_PIXEL)
		{
			GObject* obj = (GObject*)(new Landscape(sprite_name, type, CL_Pointf((float)i, (float)j)));
			Layer layer = LAYERTERRAIN;
			if (type == BUSHES)
				layer = LAYERBUSHES;
			Play::getInstance()->newObject(obj, layer);
		}
	}
}